import com.dataiti.sgsl.SGSLApplet;

 /*
 * Created on Mar 30, 2010
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */

/**
 */
public class TestSGSLLibraryFeatures extends SGSLApplet {

	private static final long serialVersionUID = 1L; // silence warning


	
	public final void draw() {
		setGridLines(true);
//		setColor(black);

		//
		// let's draw a graph centered approximately on Boston, MA, USA.
		//
		//		setCenter(42.3, 360-72.2); // west longitude means 360 minus the value.
		//	
		//	
		//	//	 setWidthAndHeight(5);
		//		
		//		 // change to 3 (zoom in) causes null pointer
		//		 setDrawPositionLon(360-72);
		//		 setDrawPositionLat(42);
		//		 drawPoint();
		//		 setLabelSize(0.2);
		//		 drawLabel("boston");
		//		 drawCircle(3);
		//		 
		//		 printMessage("this is some text.\n and some more");
		//		 setGridLines(true);
		
		setDrawingPosition(15, 30);
		setLabelSize(0.05);
		drawLabel("label whose leftmost text begins at 15N 30E");
		drawFilledCircle(6.0);
		double radius = (360/24.0); // There are 24 longitude lines in the grid. Let's match grid lines (I hope)
		                            // at any given latitude a circle of this radius whose center is at longitude 0 should
		                            // just touch the longitude lines on either side.
		double lon = 90.0;
		double lat = 90.0 - radius;
		double colorNum = 0.0;
		setCenter(90,0.0); // north pole
		setWidthAndHeight(100); // should show earth to approximately 40 degrees north latitude. 
		for (int i = 0; i < 10; i++) {
			setDrawingPosition(lat, lon);
			setColor(colorNum++);
			drawCircle(radius);
			lat -= radius;
		}
		
		for (int i = 0; i < 10; i++) {
			printMessage("Message " + i + ": this is some text.\n and some more\n");
		}
		
		lon = 270.0;
		lat = 90.0 - radius;
		for (int i = 0; i < 10; i++) {
			setDrawingPosition(lat, lon);
			setColor(colorNum++);
			drawFilledCircle(radius);
			lat -= radius;
		}
			
		lat = 1.0;
		lon = 1.0;
		colorNum = 0.0;
		for (double i = 0.0; i < 30; i++) {
			setColor(colorNum++);
			drawArc(lat, lon, -3*lat+20, 3*lon+20);
			lat++;
			lon++;
		}
		
		lat = 1.0;
		lon = 180.0;
		colorNum = 0.0;
		for (double i = 0.0; i < 10; i++) {
			setColor(colorNum++);
			setDrawingPosition(lat, lon);
			this.setLabelSize(0.01 * colorNum);
			drawLabel("label text");
			lat+=10;
			lon+=10;
		}

		lat = -42.5;
		lon = 137.5;
		colorNum = 0.0;
		for (radius = 5.0; radius < 30; radius += 5) {
			setColor(colorNum++);
			setDrawingPosition(lat, lon);
			drawCircle(radius);
			drawArc(lat,lon,  lat-radius, lon); //north
			drawArc(lat,lon, lat+radius, lon); //south
			drawArc(lat,lon, lat, lon-radius); //west
			drawArc(lat,lon, lat, lon+radius); //east
			lon += 5;
			lat += 10;
		}


	}

}



